/**
 * 
 */
package com.wxpay.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.google.gson.Gson;
import com.system.controller.base.BaseController;
import com.system.property.WXProperty;
import com.wxpay.util.PayCommonUtil;

/**
 * @author zhanglingbing
 * @date 2018年5月31日
 */
@Controller
@RequestMapping(value = "/weixinLogin")
public class WeiXinLoginController extends BaseController {
	
	@RequestMapping(value = "/getToken")
	public String getAccessToken(){
		String appid = WXProperty.get("APP_ID");
		String secret = WXProperty.get("APP_SECRET");
		String grant_type = "client_credential";
		
		String param = "grant_type="+grant_type+"&appid="+appid+"&secret="+secret;
		System.out.println(param);
		String resultMsg = PayCommonUtil.sendGetRequest(  
       		 "https://api.weixin.qq.com/cgi-bin/token?"+param);
		
		
		System.out.println(resultMsg);
		return resultMsg;
	}

}
